package com.atguigu.gmall.seckill.service;

import com.atguigu.gmall.mq.seckill.SeckillOrderMsg;
import com.atguigu.gmall.seckill.entity.SeckillGoods;
import com.atguigu.gmall.seckill.vo.SeckillOrderConfirmVo;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 *
 */
public interface SeckillGoodsService extends IService<SeckillGoods> {

    //从缓存中查询数据
    List<SeckillGoods> getSeckillGoodsByDayFromCache(String date);

    //把参与秒杀的商品保存到本地缓存
    void saveToLocalCache(List<SeckillGoods> goodsByDay);

    //查询指定日期参与秒杀的所有商品
    List<SeckillGoods> getSeckillGoodsByDay(String date);

    //查询秒杀商品详情
    SeckillGoods getDetail(Long skuId);

    //1数据库扣库存
    void deduceStock(Long id);

    //2临时保存一个秒杀单数据
    void saveSeckillOrder(SeckillOrderMsg msg);

    //3更新redis中的库存标识
    void updateRedisStock(SeckillOrderMsg msg);

}
